package org.vehicle.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.vehicle.dao.DataRecordInfoMapper;
import org.vehicle.entity.DataRecordInfo;
import org.vehicle.service.DataRecordInfoService;
import org.vehicle.service.base.BaseServiceImpl;
@Service
public class DataRecordInfoServiceImpl extends BaseServiceImpl<DataRecordInfo, Long> implements DataRecordInfoService{
    @Resource
    private DataRecordInfoMapper dataRecordInfoMapper;
	
    public Map<String, Object> getDataRecordInfoList(Map<String, Object> paramMap) {
    	List<DataRecordInfo> dataRecordInfoList = dataRecordInfoMapper.getDataRecordInfoList(paramMap);
        Integer count = dataRecordInfoMapper.getDataRecordInfoCount(paramMap);
        //分页数据
        Map<String, Object> dataMap = new HashMap<String, Object>();
        dataMap.put("totalCount", count);
        dataMap.put("list", dataRecordInfoList);
        dataMap.put("currentPage", paramMap.get("currentPage"));
        return dataMap;
    }
    
    public Map<String, Object> getPersonAlertList(Map<String, Object> paramMap) {
    	List<DataRecordInfo> personAlertList = dataRecordInfoMapper.getPersonAlertList(paramMap);
    	Integer count = dataRecordInfoMapper.getPersonAlertCount(paramMap);
    	//分页数据
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("totalCount", count);
    	dataMap.put("list", personAlertList);
    	dataMap.put("currentPage", paramMap.get("currentPage"));
    	return dataMap;
    }
    
    public Map<String, Object> getCheckPersonCount(Map<String, Object> paramMap){
    	paramMap.put("checkType", 2);
    	Integer vehicleDeviceCheckCount = dataRecordInfoMapper.getCheckPersonCount(paramMap);
    	paramMap.put("checkType", 1);
    	Integer deviceCheckCount = dataRecordInfoMapper.getCheckPersonCount(paramMap);
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("deviceCheckCount", deviceCheckCount);
    	dataMap.put("vehicleDeviceCheckCount", vehicleDeviceCheckCount);
    	return dataMap;
    }
    
    public Map<String, Object> getAlertCount(Map<String, Object> paramMap){
    	Integer alertCount = dataRecordInfoMapper.getAlertCount(paramMap);
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("alertCount", alertCount);
    	return dataMap;
    }
    
    public Map<String, Object> getDisposeCount(Map<String, Object> paramMap){
    	Integer disposeCount = dataRecordInfoMapper.getDisposeCount(paramMap);
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("disposeCount", disposeCount);
    	return dataMap;
    }
    
    public Map<String, Object> getStatistics(){
    	List<Map<String, Object>> list = dataRecordInfoMapper.getStatistics();
        Map<String, Object> dataMap = new HashMap<String, Object>();
        dataMap.put("list", list);
        return dataMap;
    }
    
    public Map<String, Object> getTodayPersonCount(){
    	List<Map<String, Object>> list = dataRecordInfoMapper.getTodayPersonCount();
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("list", list);
    	return dataMap;
    }
    
    public Map<String, Object> getSevenDaysPersonCount(Map<String, Object> paramMap){
    	List<Map<String, Object>> list = dataRecordInfoMapper.getSevenDaysPersonCount(paramMap);
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("list", list);
    	return dataMap;
    }
    
    public Map<String, Object> getSevenDaysVehicleLicenseCount(Map<String, Object> paramMap){
    	List<Map<String, Object>> list = dataRecordInfoMapper.getSevenDaysVehicleLicenseCount(paramMap);
    	Map<String, Object> dataMap = new HashMap<String, Object>();
    	dataMap.put("list", list);
    	return dataMap;
    }

}